import serverConfig from "../config";
import axios from "axios";
import glossary from "./glossary";

export function kgAdapter(kgName,sentence,res){
  switch(kgName) {
    case "ownthink.com":
      let url = encodeURI(`${serverConfig.kgUrl}&spoken=${sentence}`);
      axios.get(url).then(response=>{
        res.json(response.data)
      }).catch(err=>{
        res.status(500).send({data:{err},msg:glossary.badRequest})
      })
      break;
      //在下面添加第三方知识库的对接实现
    default:
      res.status(500).send({data:{err},msg:glossary.badRequest})
      break;
  }
}
